<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!-- SQL_Debug.jsp -->
<div align="center">
  <table width="800" cellspacing="0" cellpadding="0" border="0">
    <tbody>
      <tr>
        <td valign="top" style="padding: 0px; width: 100%;">
          <div class="box_region left">
            <div class="box">
              <div class="top">
                <div class="left">
                  <div class="right">
                    <div class="middle">
                      <div class="box_title"><span class="boxtitle">SQL Debug Query</span></div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="content">
                <form style="display: inline;" name="MyForm" method="post">
                  <table cellspacing="2" cellpadding="0" border="0" width="100%">
                    <tbody>
                      <tr>
                        <td>Please enter the SQL statements, separated by semi-colon ';'</td>
                      </tr>
                      <tr>
                        <td nowrap>
                          <textarea cols="150" rows="10" name="sql">${sql}</textarea>
                        </td>
                      </tr>
                      <tr>
                        <td colspan="3">
                          <table cellspacing="0" cellpadding="0" border="0" class="form_submit" summary="">
                            <tbody>
                              <tr>
                                <td>
                                  <input type="submit" class="buttontext" value="Execute All" />
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </form>
              </div>
              <div class="bottom">
                <div class="left">
                  <div class="right">
                    <div class="middle">
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td valign="top" style="padding: 0px; width: 100%;">
          <div class="box_region left">
            <div class="box">
              <div class="top">
                <div class="left">
                  <div class="right">
                    <div class="middle">
                      <div class="box_title"><span class="boxtitle">Query Result</span></div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="content">
                <c:forEach items="${results}" var="debugTable">
                  <br />
                  <table cellspacing="1" cellpadding="5" border="1" width="100%">
                    <tbody>
                      <tr>
                        <td colspan="${fn:length(debugTable.headers)}">
                          <pre>SQL&gt; <c:out escapeXml="true" value="${debugTable.sql}" /></pre>
                        </td>
                      </tr>
                      <tr>
                        <c:forEach items="${debugTable.headers}" var="el">
                          <th><c:out escapeXml="true" value="${el}" /></th>
                        </c:forEach>
                      </tr>
                      <c:forEach items="${debugTable.body}" var="row">
                        <tr>
                          <c:forEach items="${row}" var="el">
                            <td nowrap><c:out escapeXml="true" value="${el}" /></td>
                          </c:forEach>
                        </tr>
                      </c:forEach>
                    </tbody>
                  </table>
                  <br />
                </c:forEach>
              </div>
              <div class="bottom">
                <div class="left">
                  <div class="right">
                    <div class="middle">
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </td>
      </tr>
    </tbody>
  </table>
</div>
<!-- End of SQL_Debug.jsp -->
